<?php

namespace app\api\controller\driver;

use app\common\controller\Api;
use app\common\service\driver\DriverInviteService;
use think\Validate;

/**
 * 司机端-我的小队接口
 * @ApiWeigh (82)
 */
class Invite extends Api
{
    protected $beforeActionList = [
        'create_before' => ['only' => 'create'],
    ];
    protected $noNeedLogin = [''];
    protected $noNeedRight = ['*'];

    public function _initialize()
    {
        parent::_initialize();
    }

    /**
     * @ApiInternal
     */
    public function create_before()
    {
        $params = $this->request->post();
        if(empty($params['qrcode_wechat']) && empty($params['qrcode_alipay'])){
            $this->success('success');
        }
    }


    /**
     * 我的小队
     *
     * @ApiMethod (POST)
     * @ApiReturnParams (name=data,type="object",description=要返回的数据)
     * @ApiReturn ({"code":1,"msg":"我的小队","time":"1721317402","data":{"total_num":"总数量","today_num":"今日数量","total_amount":"总金额","today_amount":"今日金额"}})
     **/
    public function index()
    {
        $user = $this->auth->getUser();
        $this->success('我的小队', DriverInviteService::index($user,__FUNCTION__));
    }

    /**
     * 小队成员
     *
     * @ApiMethod (POST)
     * @ApiReturnParams (name=data,type="object",description=要返回的数据)
     * @ApiReturnParams (name=data.data,type="array",description=要返回的数据)
     * @ApiReturn ({"code":1,"msg":"小队奖励","time":"1721317402","data":{"total_num":"总数量","today_num":"今日数量","total_amount":"总金额","today_amount":"今日金额","data":[{"id":2,"nickname":"昵称","avatar":"头像","createtime":"时间"}]}})
     **/
    public function list()
    {
        $user = $this->auth->getUser();
        $list = DriverInviteService::list($user,__FUNCTION__);
        $this->success('小队成员', $list);
    }

    /**
     * 小队奖励
     *
     * @ApiMethod (POST)
     * @ApiReturnParams (name=data,type="object",description=要返回的数据)
     * @ApiReturnParams (name=data.data,type="array",description=要返回的数据)
     * @ApiReturn ({"code":1,"msg":"小队奖励","time":"1721317402","data":{"total_num":"总数量","today_num":"今日数量","total_amount":"总金额","today_amount":"今日金额","data":[{"id":2,"driver_id":2,"money":"奖励金额","createtime":"时间"}]}})
     **/
    public function list_money()
    {
        $user = $this->auth->getUser();
        $list = DriverInviteService::list($user,__FUNCTION__);
        $this->success('小队奖励', $list);
    }


}
